package com.tarena.lbs.marketing.web.rpc;

import com.tarena.lbs.marketing.web.repository.MarketingActivityRepository;
import com.tarena.lbs.marketing.api.MarketingApi;
import com.tarena.lbs.pojo.marketing.bo.MarketingActivityBO;
import javax.annotation.Resource;
import org.springframework.stereotype.Component;

@Component
public class MarketingApiImpl implements MarketingApi {

    @Resource
    private MarketingActivityRepository marketingActivityRepository;


    @Override
    public Integer getActivityByStoreId(Integer shopId) {
        MarketingActivityBO marketingActivityBO = marketingActivityRepository.getActivityByStoreId(shopId);
        return marketingActivityBO == null ? 0 : marketingActivityBO.getId();
    }

    @Override
    public MarketingActivityBO getActivityById(Integer id) {
        MarketingActivityBO marketingActivityBO = marketingActivityRepository.getActivityById(id);
        return marketingActivityBO;
    }

}
